#!/usr/bin/env python
# -*- coding: utf-8 -*-

'''这句话是代表下面这个类是新式类'''
__metaclass__ = type

class Person:                                       # 创建类
    def __init__(self, name):                       # 构建函数
        self.name = name

    def getName(self):                              # 类中的方法（函数）
        return self.name

    def color(self, color):
        print "%s is %s" % (self.name, color)

    def speak(self):
        print "I love you."

girl = Person("Yuik")                               # 实例化
print girl.getName()                                # 调用方法（函数）
girl.color("White")                                 # 调用方法（函数）
print girl.name                                     # 实例的属性

'''继承'''
class People:                                       # 创建类

    def color(self, color):
        print "I like %s" % (color)

    def speak(self):
        print "I love you."

class Girl(People):
    def sayHello(self):
        print 'Hi, I am a girl'

if __name__ == "__main__":
    chang = Girl()
    chang.sayHello()
    chang.color('blue')

'''多重继承'''
class Person:
    def eye(self):
        print "two eyes"

    def breast(self, n):
        print "The breast is: ",n

class Girl:
    age = 28
    def color(self):
        print "The girl is white"

class HotGirl(Person, Girl):
    pass

if __name__ == "__main__":
    kong = HotGirl()
    kong.eye()
    kong.breast(90)
    kong.color()
    print kong.age